<?php
class   DAO_Trace_Mark
{
	public static $sn=0;
	public static $max=1000;
	public static $mark;
	public static function step()
	{
		self::$sn =(rand() % self::$max);
		if(PHP_OS!="WINNT")
		{
			$pid = posix_getpid()%1000;
		}
		else
		{
			$pid = time()%1000;
		}
		self::$mark =sprintf("%03d%s%03d",$pid ,date('is'),self::$sn);
	}
	public static function curr()
	{
		if(!isset(self::$mark)||strlen(self::$mark)==0)
		{
			self::step();
		}
		return self::$mark;
	}

}

class   DAO_SN
{
	public  $sn=0;
	public  $max=1000;
	public function DAO_SN($max_val = 1000)
	{
		$max = $max_val;
	}
	public  function step()
	{
		$this->sn++;
		if($this->sn>=$this->max)
		{
			$this->sn = 0;
		}
	}
	public  function curr()
	{
		return $this->sn;
	}
}

?>